﻿using System;
using System.Reflection;
using Castle.DynamicProxy;

namespace Janus.Cores.DynamicProxy.CastleDynamic.Interception
{
    /// <summary>
    /// 功能：计算程序运行时间的拦截器
    /// 作者：luochengbang@163.com
    /// 日期：2012/3/19 11:58:31 
    /// 备注：本代码版权归Janus所有，严禁外传 
    /// </summary>
    public class StopwatchHandlingInterceptor : HandlingInterceptorBase
    {
        /// <summary>
        /// 执行拦截
        /// </summary>
        /// <param name="invocation"></param>
        public override void DoIntercept(IInvocation invocation)
        {
            ////if (Application.AppRuntime.Instance.Bus != null)
            //{
            //    MemberInfo memberInfo = invocation.Method;
            //    string name = CreateName(memberInfo);

            //    Log.Logger.Monitor(invocation.TargetType.FullName, name);
            //    Log.Logger.Monitor(() =>
            //     {
            //         invocation.Proceed();

            //     }, name);
            //}
            //else
            //{
            invocation.Proceed();
            //}
        }
    }
}
